﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoolCode.UnitTest 
{
    public interface ICodeTimer
    {
        void Time(string name, int iteration, Action action);
    }

    public class CodeTimerProvider
    {
        private ICodeTimer _CodeTimer;

        private static readonly CodeTimerProvider _self = new CodeTimerProvider();

        private CodeTimerProvider()
        {
            WindowsVersion osVersion = WindowsInformation.GetVersion();
            if ((int)osVersion >= (int)WindowsVersion.Vista)
            {
                _CodeTimer = new UnitTimer();
            }
            else
            {
                _CodeTimer = new XP.UnitTimer();
            }
        }

        public static ICodeTimer Provide()
        {
            return _self._CodeTimer; ;
        }
    }
}
